#ifndef _TMP141_H_
#define _TMP141_H_

#include "stm32f10x.h"

#define SET_DQ()        GPIO_SetBits(GPIOC,GPIO_Pin_9)
#define CLR_DQ()        GPIO_ResetBits(GPIOC,GPIO_Pin_9)

#define GET_DQ()        GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_9)

void delay_us(u16 us);

void Onewire_Enable_GPIO_Port(void);
void Onewire_OUT_PULL_UP(void);
void Onewire_OUT_FLOATING(void);
void Onewire_IN_FLOATING(void);
void Onewire_IN_PULL_UP(void);
void Send_Start(void);
void write_bit(unsigned char bitik);
char get_bit(void);
unsigned char get_byte(void);
char byte_parity(unsigned char device_NO, unsigned char regst_NO, unsigned char R_W, char byte);
char word_parity(unsigned char device_NO, unsigned char regst_NO, unsigned char R_W, int word);
void write_device_regst(unsigned char device_NO, char regst_NO);
void Onewire_write_word(char device_NO, char regst_NO, int word);
int Onewire_read_word(char device_NO, char regst_NO);
void Tmp141_Condig(void);

#endif
